model{
 ## measurement model
 for(i in 1:n.poll){
       mu[i] <- house[nPollHouse[i]] + alpha[date[i]]
       y[i] ~ dnorm(mu[i], tau.y)
 }

 ## transition model (aka random walk prior)
 for(i in 2:n.period){
        mu.alpha[i] <- alpha[i-1]
        alpha[i] ~ dnorm(mu.alpha[i], tau)
	## new.alpha[i] ~ dnorm(mu.alpha[i], tau)
 }

 ## priors
 tau.y <- 1/pow(sigma.y, 2)   ## deterministic transform to precision
 sigma.y ~ dunif(0, 1)    ## uniform prior on standard deviation
 
 tau <- 1/pow(sigma, 2)   ## deterministic transform to precision
 sigma ~ dunif(0, .1)    ## uniform prior on standard deviation
 
 ## before we see the data, the trend moves up and down by +-0.2
 ## around the time-varying mean

 ## initialization of daily track
 alpha[1] ~ dunif(a01, a02)

 for(i in 1:n.house){          
 ## standard deviation of 0.05
   house[i] ~ dnorm(0, 400)
 }

 ## what would happen if the election happens tomorrow?
 ## new.alpha ~ dnorm(alpha[n.period], tau)
}
